package com.shopping_back.serviceImpl;

import com.shopping_back.mapper.DashboardMapper;
import com.shopping_back.service.IDashboardService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 仪表盘数据服务实现 (基于 MyBatis-Plus Mapper)
 */
@Service
@RequiredArgsConstructor
public class DashboardServiceImpl implements IDashboardService {

    private final DashboardMapper dashboardMapper;

    @Override
    public List<Map<String, Object>> getOrderStatusDistribution() {
        return dashboardMapper.selectOrderStatusDistribution();
    }

    @Override
    public List<Map<String, Object>> getTopSellingSkus(int topN) {
        return dashboardMapper.selectTopSellingSkus(topN);
    }

    @Override
    public List<Map<String, Object>> getPromotionParticipation() {
        return dashboardMapper.selectPromotionParticipation();
    }

    @Override
    public List<Map<String, Object>> getEvaluationRatingDistribution() {
        return dashboardMapper.selectEvaluationRatingDistribution();
    }
}
